<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of SupervisorPractica
 *
 * @author Usuario
 */

use Fuel\Core\Input;
    
use Model\SupervisorPracticacrud;

class Controller_SupervisorPractica extends Controller {
    //put your code here
    public function action_index(){
            
            return Response::forge(View::forge('supervisorPractica/index'));
        }
        
    public function action_guardar(){
        
        $datos['codSpractica']=  Input::post('codSpractica');
        $datos['ced_sp']=  Input::post('ced_sp');
        $datos['nombre_sp']=  Input::post('nombre_sp');
        $datos['apellido_sp']=  Input::post('apellido_sp');
        $datos['cel_sp']=  Input::post('cel_sp');
        $datos['tel_sp']=  Input::post('tel_sp');
        $datos['mail_sp']=  Input::post('mail_sp');
        
        
        $res= SupervisorPracticacrud::insert_supervisorpracticante($datos);
        
        if(is_numeric($res)){
            $response['type']='result';
            $response['message']='El proceso fue creado con extito';
            $response['extra']['id']=$res;
        }else{
            if(is_array($res) && empty($res)){
                $response['type']='errorlist';
                $response['list']=$res;
            }else{
                $response['type']='message';
                $response['message']='No ocurrio ninguna actualizacion';
            }
        }
        
        Response::forge(View::forge('estudiante/index',$response));
       return Response::redirect('welcome/index');
        
    }
    
}

?>
